home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
v cisle
/
sadanastroju
/
wot-20080519-fx.xpi
/
chrome
/
wot.jar
/
content
/
status.js
< prev
next >
Wrap
Text File
|
2008-05-07
|
3KB
|
111 lines
/*
status.js
Copyright ⌐ 2005, 2006, 2007 Against Intuition, Inc. <info@mywot.com>
*/
var wot_status =
{
init: function()
{
},
set: function(status, description)
{
try {
if (wot_update.isavailable()) {
status += "-update";
} else if (wot_api_query.message.length > 0 &&
wot_api_query.message_type.length > 0 &&
wot_api_query.message_id != wot_prefs.last_message &&
wot_api_query.message_id != WOT_SERVICE_XML_QUERY_MSG_ID_MAINT) {
status += "-update";
}
/* Set tooltip and status */
var mainwnd = document.getElementById("main-window");
if (mainwnd) {
mainwnd.setAttribute("wot-status", status);
}
var tooltip = document.getElementById("wot-tooltip-text");
if (tooltip) {
tooltip.value = description;
}
/* Update display */
wot_ui.update(description);
} catch (e) {
dump("wot_status.set: failed with " + e + "\n");
}
},
update: function()
{
try {
if (!wot_api_register.ready) {
return;
}
var reputation = -1;
if (wot_cache.isok(wot_core.hostname)) {
reputation = wot_cache.get(wot_core.hostname,
"reputation_0");
}
if (reputation > WOT_MAX_REPUTATION) {
reputation = WOT_MAX_REPUTATION;
}
/* Set status and description */
var status, description, testimonies = false;
for (var i = 0; i < WOT_APPLICATIONS; ++i) {
if (wot_cache.get(wot_core.hostname, "testimony_" + i) >= 0) {
testimonies = true;
break;
}
}
if (reputation >= WOT_MIN_REPUTATION_5) {
status = "5";
} else if (reputation >= WOT_MIN_REPUTATION_4) {
status = "4";
} else if (reputation >= WOT_MIN_REPUTATION_3) {
status = "3";
} else if (reputation >= WOT_MIN_REPUTATION_2) {
status = "2";
} else if (reputation >= 0) {
status = "1";
} else {
status = "0";
}
description = wot_util.getstring("description_rating_" + status);
if (testimonies) {
status += "-testimony";
}
this.set(status, description);
var type = wot_warning.isdangerous(wot_core.hostname, true);
if (type == WOT_WARNING_NOTIFICATION ||
type == WOT_WARNING_DOM) {
window.setTimeout(wot_browser.show_warning,
WOT_DELAY_WARNING, wot_core.hostname,
wot_util.getstring("warning_message"));
}
if (type == WOT_WARNING_DOM) {
wot_warning.add(wot_core.hostname,
getBrowser().selectedBrowser.contentDocument);
}
} catch (e) {
dump("wot_status.update: failed with " + e + "\n");
}
}
};
wot_status.init();